<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>巫谢的博客</title>
    <!--
    <link rel="stylesheet" href="/Public/bootstrap/css/bootstrap.min.css">
    <script src="/Public/bootstrap/scripts/jquery.min.js"></script>
    <script src="/Public/bootstrap/js/bootstrap.min.js"></script>
    -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://pingendo.github.io/pingendo-bootstrap/themes/default/bootstrap.css" rel="stylesheet" type="text/css">-->
    <script type="text/javascript" src="/Public/js/jquery.min.js"></script>
    <script type="text/javascript" src="/Public/js/bootstrap.min.js"></script>
    <link href="/Public/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="/Public/css/bootstrap.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="section">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <h1 class="text-left">巫谢的博客</h1>
                <ul class="text-right">
                    <li>欢迎您：<?php echo ($admin_name); ?></li>
                    <li><a href="/" target="_blank">前台首页</a></li>
                    <li><a href="<?php echo U('Login/logout');?>">退出登录</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="section">
    <div class="container">
        <div class="row">
            <div class="col-md-2">
                <p>菜单</p>
                <ul class="nav nav-pills nav-stacked">
                    <li><a href="<?php echo U('Index /index');?>">后台首页</a></li>
                    <li><a href="#">新增博文</a></li>
                    <li><a href="<?php echo U('Blog/index');?>">博文列表</a></li>
                    <li><a href="<?php echo U('Category/add');?>">新增分类</a></li>
                    <li><a href="<?php echo U('Category/index');?>">分类列表</a></li>
                    <li><a href="#">回收站</a></li>
                </ul>
            </div>
            <div class="col-md-10">
                <div class="section">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <table width="500">
                    <tr><th>分类名称</th><th>操作</th></tr>
                    <?php if(is_array($category)): foreach($category as $key=>$v): ?><tr><td><?php echo str_repeat('— ',$v['level']); echo ($v["name"]); ?></td><td><a href="<?php echo U('Category/edit',array('id'=>$v['id']));?>">修改</a>　<a href="#" class="act-del" data-id="<?php echo ($v["id"]); ?>" >删除</a></td></tr><?php endforeach; endif; ?>
                </table>
                </ul>
            </div>
        </div>
    </div>
</div>
<form method="post" id="form">
    <input type="hidden" name="id" id="target_id">
</form>
<script>
    //删除
    $(".act-del").click(function(){
        if(confirm('确定要删除吗？（该分类下的商品将归于未分类）')){
            $("#target_id").val($(this).attr("data-id"));
            $("#form").attr("action","<?php echo U('Category/del');?>").submit();
        }
    });
</script>
            </div>
        </div>
    </div>
</div>
<footer class="section section-primary">
    <div class="container">

    </div>
</footer>
</body>
</html>